home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / bit / src / mpeg / util32.c < prev    next >
C/C++ Source or Header  |  1994-08-01  |  2KB  |  76 lines

  1. #include <stdio.h>
  2. #if 0
  3. #include <X11/Xlib.h>
  4. #include <X11/Xutil.h>
  5. #endif
  6. #include "video.h"
  7. #include "proto.h"
  8.  
  9. #if 0
  10. /*
  11.  * Return a pointer to a full color bit visual on the dpy
  12.  */
  13. Visual *
  14. FindFullColorVisual (dpy, depth)
  15.     Display *dpy;
  16.     int *depth;
  17. {
  18.   XVisualInfo vinfo;
  19.   XVisualInfo *vinfo_ret;
  20.   int numitems, maxdepth;
  21.   
  22.   vinfo.class = TrueColor;
  23.   
  24.   vinfo_ret = XGetVisualInfo(dpy, VisualClassMask, &vinfo, &numitems);
  25.   
  26.   if (numitems == 0) return NULL;
  27.  
  28.   maxdepth = 0;
  29.   while(numitems > 0) {
  30.     if (vinfo_ret[numitems-1].depth > maxdepth) {
  31.       maxdepth = vinfo_ret[numitems-1 ].depth;
  32.     }
  33.     numitems--;
  34.   }
  35.   XFree(vinfo_ret);
  36.  
  37.   if (maxdepth < 24) return NULL;
  38.  
  39.   if (XMatchVisualInfo(dpy, DefaultScreen(dpy), maxdepth, 
  40.                TrueColor, &vinfo)) {
  41.     *depth = maxdepth;
  42.     return vinfo.visual;
  43.   }
  44.   
  45.   return NULL;
  46. }
  47.  
  48. Window
  49. CreateFullColorWindow (dpy, x, y, w, h)
  50.     Display *dpy;
  51.     int x, y, w, h;
  52. {
  53.     int depth;
  54.     Visual *visual;
  55.     XSetWindowAttributes xswa;
  56.     unsigned int mask;
  57.     unsigned int class;
  58.     int screen;
  59.  
  60.     screen = XDefaultScreen(dpy);
  61.     class = InputOutput;    /* Could be InputOnly */
  62.     visual = FindFullColorVisual (dpy, &depth);
  63.     if (visual == NULL) {
  64.     return 0;
  65.     }
  66.     mask = CWBackPixel | CWColormap | CWBorderPixel;
  67.     xswa.colormap = XCreateColormap(dpy, XRootWindow(dpy, screen),
  68.             visual, AllocNone);
  69.     xswa.background_pixel = BlackPixel(dpy, DefaultScreen(dpy));
  70.     xswa.border_pixel = WhitePixel(dpy, DefaultScreen(dpy));
  71.  
  72.     return XCreateWindow(dpy, RootWindow(dpy, screen), x, y, w, h,
  73.     1, depth, class, visual, mask, &xswa);
  74. }
  75. #endif
  76.